# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2023/11/26
desc: 
sample: 
"""
import random

import pymysql

connection = pymysql.connect(host='192.168.79.170',
                             port=3307,
                             user='root',
                             password='123456',
                             db='exam_db')
#cursor = connection.cursor() #返回 (()) 元祖集合
cursor = connection.cursor(cursor=pymysql.cursors.DictCursor) #支持 [{}] 字典集合
cursor.execute("SELECT name,password FROM student")
rows = cursor.fetchall()
print(rows)
print(random.choice(rows))
